<!--
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2022-02-04 20:00:46
 * @LastEditors: GGB
 * @LastEditTime: 2022-02-04 21:27:18
-->
<template>
    <div class="swiper">
        <div class="swiper-bg" :style="bgColor" />
        <a-carousel arrows autoplay :before-change="beforeChange">
            <template #prevArrow>
                <div class="custom-slick-arrow" style="left: 10px; z-index: 1">
                    <left-circle-outlined />
                </div>
            </template>
            <template #nextArrow>
                <div class="custom-slick-arrow" style="right: 10px">
                    <right-circle-outlined />
                </div>
            </template>
            <div class="swiper-item" v-for="item, i in props.banner" :key="i">
                <div class="banner-left">
                    <h3
                        :style="{ color: item.text_color }"
                    >{{ item.desktop_sub_title || item.sub_title }}</h3>
                    <h1 :style="{ color: item.text_color }">{{ item.desktop_title || item.title }}</h1>
                </div>
                <div class="banner-right">
                    <img :src="item.imgsrc" />
                </div>
            </div>
        </a-carousel>
    </div>
</template>
<script setup>
import { reactive, ref } from "vue"
import { LeftCircleOutlined, RightCircleOutlined } from '@ant-design/icons-vue';
const props = defineProps({
    banner: Array
});
const current = ref(0)
const bgColor = reactive({
    backgroundColor: props.banner[0].bg_color
})
const beforeChange = (from, to) => {
    bgColor.backgroundColor = props.banner[to].bg_color
}
</script>

<style scoped  lang="less">
.swiper-bg {
    position: absolute;
    display: block;
    width: 100%;
    height: 575px;
    transform-origin: 0 0;
    transform: skew(0, -8deg);
    transition: all 0.5s;
}
/* For demo */
.ant-carousel :deep(.slick-slide) {
    text-align: center;
    height: 575px;
    // line-height: 575px;
    //   background: #364d79;
    overflow: hidden;
}
.ant-carousel :deep(.swiper-item) {
    height: 575px;
    display: flex !important;
    min-width: 1200px;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    .banner-left {
        display: flex !important;
        width: 340px;
        padding-right: 100px;
        flex-direction: column;
        align-items: flex-end;
    }
    h3 {
        font-size: 30px;

        font-weight: 900;
        margin: 0;
        line-height: 40px;
    }
    h1 {
        font-size: 60px;

        font-weight: 900;
        margin: 0;
        line-height: 70px;
    }
    .banner-right {
        margin-top: 45px;
        transform-origin: 0 100%;
        transform: skew(0, -8deg);
        overflow: hidden;
        border-radius: 20px;
        border-bottom-right-radius: 80px;
        img {
            transform-origin: 0 100%;
            transform: skew(0, 8deg);
            border-radius: 20px;
            border-bottom-right-radius: 80px;
        }
    }
}

.ant-carousel :deep(.slick-arrow.custom-slick-arrow) {
    width: 25px;
    height: 25px;
    font-size: 25px;
    color: #fff;
    background-color: rgba(31, 45, 61, 0.11);
    opacity: 0.3;
    z-index: 1;
}
.ant-carousel :deep(.custom-slick-arrow:before) {
    display: none;
}
.ant-carousel :deep(.custom-slick-arrow:hover) {
    opacity: 0.5;
}

.ant-carousel :deep(.slick-slide h3) {
    color: #fff;
}
</style>